<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <h1>{{state.count}}</h1>
    <button @click="say">点击</button>
  </div>
    <script src="./vue.js"></script>
    <script>
      // 让一个对象可响应。Vue 内部会用它来处理 data 函数返回的对象
      // Vue.observable 创建响应式数据
      const state = Vue.observable({ count: 0 })
      //查看当前vue版本
      console.log(Vue.version) 

      

      let sta={count:1} //非响应式数据
        new Vue({
            el:"#app",
            data(){
              return {
                 state:state
              }
            },
            methods: {
              say(){
                console.log(Vue.version)
                let ver=Vue.version.split('.')
                if(ver[0]==2){
                  console.log("vue2")
                }else if(ver[0]==3){
                    console.log("vue3")
                }
                state.count++
              }
            },
        })
    </script>
</body>
</html>